package bbsimon.first.reg;

import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import bbsimon.first.model.reg.RegModel;

public class ListRegServlet extends HttpServlet {
	public void doPost(HttpServletRequest req, HttpServletResponse res)
		throws IOException, ServletException { 
			res.setContentType("text/html");
			PrintWriter out = res.getWriter();

			RegModel rm = new RegModel();

			List<String> all = rm.list();

			out.println("<html><head><title>List all regs</title></head><body>"
					+ "<h1>all registered emails</h1><ul>");
			Iterator it = all.iterator();
			while(it.hasNext()) {
				out.println("<li>\"" + it.next()+ "\"</li>");
			}
			out.println("</ul><br><a href=\"./\">Back to homepage</a>"
					+ "</body></html>");
		}
}
